<template>
    <div class="page_home">
        <x-header></x-header>
        <main class="Site-content">
            <img src="../assets/images/bg_01.png" alt="" width="100%"/>
            <div class="introduce">
                <p class="intro_text">本赛段从名为丝绸之路，从嘉峪关行走到伊斯兰堡，赛 段里程共计2250公里，350万步。活动使用HeHa App计步。
                </p>
                <div class="intro_time">
                    <ul>
                        <li v-for="(item,index) in introduces" :key="item.id">
                            <div class="title">{{item.title}}</div>
                            <div class="startTime">{{item.startTime}}</div>
                            <div class="cludes">至</div>
                            <div class="endTime">{{item.endTime}}</div>
                            <div class="state">
                                <div :class="index==0? 'state_btn':'state_btn1'">{{item.state}}</div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="intro_btn">
                    <ul>
                        <li v-for="item in introduces_btn" @click="goPage(item.param)">
                            <img :src="item.img" alt="" width="100%"/>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="group_btn">
                <ul>
                    <li v-for="item in groups_btn" @click="goPage(item.param,item.text)">
                        <img :src="item.img" alt="" width="90"/>
                        <div class="btn_text">{{item.text}}</div>
                    </li>
                </ul>
            </div>
            <div class="rankList">
                <div class="rank_title">
                    <div class="dev_line">//////////</div>
                    <div class="text">我的榜单</div>
                    <div class="dev_line">//////////</div>
                </div>
                <div class="rank_btn">
                    <ul>
                        <li v-for="item in rank_btn" @click="goPage(item.param,item.text)">
                            <img :src="item.img" alt="" width="90"/>
                            <div class="btn_text">{{item.text}}</div>
                            <div class="btn_ranking">第{{item.ranking}}名</div>
                        </li>
                    </ul>
                </div>
            </div>
        </main>
        <x-footer></x-footer>
    </div>
</template>

<script>
    import xHeader from './common/header.vue'
    import xFooter from './common/footer.vue'

    export default {
        name: '',
        components: {
            xHeader,
            xFooter
        },
        data() {
            return {
                introduces: [ // 赛事时间介绍
                    {id: '1', title: '报名时间', startTime: '2017-10-01', endTime: '2017-11-01', state: '已结束'},
                    {id: '2', title: '活动时间', startTime: '2017-11-02', endTime: '2017-12-01', state: '进行中'},
                ],
                introduces_btn: [
                    {img: require("../assets/images/icon_17.png"), param: 'introduce'},
                    {img: require("../assets/images/icon_18.png"), param: 'prizeSettings'},
                    {img: require("../assets/images/icon_16.png"), param: ''}
                ],
                groups_btn: [
                    {img: require("../assets/images/icon_personGroup.png"), text: '组建战队', param: 'buildGroup'},
                    {img: require("../assets/images/icon_person_add.png"), text: '加入战队', param: 'addGroup'},
                    {img: require("../assets/images/icon_person.png"), text: '我的战队', param: 'myGroup'},
                    {img: require("../assets/images/icon_excellent.png"), text: '分享集赞'}
                ],
                rank_btn: [
                    {img: require("../assets/images/icon_01.png"), text: '战队总榜', ranking: 200, param: 'totalRankList'},
                    {img: require("../assets/images/icon_02.png"), text: '战队分榜', ranking: 401, param: 'totalRankList'},
                    {
                        img: require("../assets/images/icon_03.png"),
                        text: '个人分榜',
                        ranking: 999 + '+',
                        param: 'totalRankList'
                    },
                    {img: require("../assets/images/icon_04.png"), text: '集赞分榜', ranking: 800}
                ]
            }
        },
        created() {

        },
        methods: {

            //点击按钮，根据参数不同跳转到不同的页面
            goPage(name,text) {
                if (name == 'buildGroup') {
                    this.$router.push({
                        name: 'buildGroup',
                        params: {
                            id: '1',
                        }
                    })
                } else if (name=='totalRankList') {
                    this.$router.push({
                        name: 'totalRankList',
                        params: {
                            page: text,
                        }
                    })
                } else {
                    this.$router.push('/' + name);
                }

            },
        },

    }
</script>

<style lang="less" rel="stylesheet/less" type="text/css" scoped>
    .page_home {
        width: 100%;
    .introduce {
        height: 18rem;
        background-color: #fff;
    .intro_text {
        text-indent: 1.2rem;
        padding: .5rem .5rem;
        line-height: 1.2rem;
    }
    .intro_time {
        height: 8rem;
    li {
        width: 49%;
        text-align: center;
        line-height: 1.5rem;
    }
    li:first-child {
        border-right: 1px solid #ccc;
    }
    .state {
        width: 6.5rem;
        text-align: center;
        margin-left: 17%;
    .state_btn {
        border: 1px solid #F53952;
        color: #F53952;
        border-radius: .5rem;
    }
    .state_btn1 {
        border: 1px solid #0081C3;
        color: #0081C3;
        border-radius: .5rem;
    }
    }
    }
    .intro_btn {
    li {
        width: 33%;
    }
    }
    }
    .group_btn {
        height: 9rem;
        background-color: #fff;
        margin-top: 1rem;
        padding-top: .8rem;
    li {
        width: 25%;
    .btn_text {
        padding-left: .75rem;
    }
    }
    }
    .rankList {
        margin-bottom: 2rem;
    .rank_title {
        padding: 1rem 0rem;
        text-align: center;
    .dev_line {
        display: inline-block;
        letter-spacing: 6px;
        font-size: .6rem;
    }
    .text {
        display: inline-block;
        padding: 0rem .8rem;
        font-size: .8rem;
    }
    }
    .rank_btn {
        height: 9rem;
        background-color: #fff;
        padding-top: 1rem;
    li {
        width: 25%;
    .btn_text {
        padding-left: .8rem;
    }
    .btn_ranking {
        padding-left: .8rem;
        color: #F53952;
    }
    }
    }
    }
    }
</style>